web3j除了实现最基本的标准JSON-RPC API,以太坊客户端,如Geth和Parity,通过JSON-RPC提供额外的管理API。
它们提供的一个关键的通用功能是创建和解锁在网络上交易的以太坊帐户的能力。在Geth和Parity中,这是在它们的私有模块中实现的,其中的细节可在下面得到:
Parity
Geth
在web3j中对这些私有模块的提供支持。这些方法对于Geth和Parity都是通用的,它存在于web3j的管理模块Admin中。
package org.web3j.protocol.admin;
import java.math.BigInteger;
import java.util.concurrent.ScheduledExecutorService;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.Web3jService;
import org.web3j.protocol.admin.methods.response.NewAccountIdentifier;
import org.web3j.protocol.admin.methods.response.PersonalListAccounts;
import org.web3j.protocol.admin.methods.response.PersonalUnlockAccount;
import org.web3j.protocol.core.Request;
import org.web3j.protocol.core.methods.request.Transaction;
import org.web3j.protocol.core.methods.response.EthSendTransaction;
/**
* JSON-RPC Request object building factory for common Parity and Geth.
*/
public interface Admin extends Web3j {
static Admin build(Web3jService web3jService) {
return new JsonRpc2_0Admin(web3jService);
}
static Admin build(
Web3jService web3jService, long pollingInterval,
ScheduledExecutorService scheduledExecutorService) {
return new JsonRpc2_0Admin(web3jService, pollingInterval, scheduledExecutorService);
}
public Request |